package com.fjh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fjh.domain.Prod;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ProdMapper extends BaseMapper<Prod> {

    @Update("update prod set total_stocks = total_stocks + #{count}, version = version+1 where prod_id = #{prodId} and total_stocks + #{count} >0")
    Integer changeProdStock(@Param("prodId") Long prodId, @Param("count") Integer count);
}